﻿using JV.Com.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;

namespace JV.Com.Converters
{
    public sealed class PreviewRatingToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var rating = (PreviewRating)value;
            switch(rating)
            {
                case PreviewRating.VeryGood: return new SolidColorBrush(Color.FromArgb(0xFF, 0xB4, 0xF5, 0x99));
                case PreviewRating.Good: return new SolidColorBrush(Color.FromArgb(0xFF, 0x9E, 0xD3, 0x00));
                case PreviewRating.Medium: return new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x68, 0x00));
                case PreviewRating.Bad: return new SolidColorBrush(Color.FromArgb(0xFF, 0xC9, 0x00, 0x00));
                default: throw new NotSupportedException();
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }

    public sealed class PreviewRatingToDisplayTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var rating = (PreviewRating)value;
            switch (rating)
            {
                case PreviewRating.VeryGood: return "Très bon";
                case PreviewRating.Good: return "Bon";
                case PreviewRating.Medium: return "Moyen";
                case PreviewRating.Bad: return "Mauvais";
                default: throw new NotSupportedException();
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }

}
